package com.yunying.rispro.controller;


import com.yunying.rispro.config.UserArgumentResolver;
import com.yunying.rispro.model.Doctor;
import com.yunying.rispro.service.IDoctorService;
import com.yunying.rispro.util.JsonResponseBody;
import com.yunying.rispro.vo.UserVo;
import org.apache.ibatis.annotations.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.web.method.support.HandlerMethodArgumentResolver;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.List;

/**
 * <p>
 * 医生信息表 前端控制器
 * </p>
 *
 * @author yunying
 * @since 2022-04-21
 */
@RestController
@RequestMapping("/doctor")
public class DoctorController {

    @Autowired
    private IDoctorService doctorService;

    @Autowired
    private UserArgumentResolver userArgumentResolver;

    //用户登录
    @PostMapping("/userLogin")
    public JsonResponseBody<?> login(@Valid UserVo userVo,
                                     HttpServletRequest req,
                                     HttpServletResponse resp){
        return doctorService.login(userVo,req,resp);
    }
    //退出登录
    @GetMapping("/userLogout")	//Authorization为前端请求参数，保存在头部
    public JsonResponseBody<?> logout(@RequestHeader("Authorization") String token){
        return doctorService.logout(token);
    }


}
